/*
 * @Author: tengda.qiu qiutengda@dingtalk.com
 * @Date: 2022-10-14 10:29:39
 * @LastEditors: tengda.qiu qiutengda@dingtalk.com
 * @LastEditTime: 2022-10-17 17:47:06
 * @FilePath: \admin-systemd:\codeSpace\visiotrip-group\uni-H5\src\https\api.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

import request from '../utils/request/request.js'
import { ResponseErrorProcessModel } from './common.js'

let apiPrefix = "/vlog/wechat"
// 获取dsp详情
export function getDspJourneyInfo(params) {
	return request({
		url: `/app/experience/new/dspJourneyInfoV2`,
		method: "POST",
		params,
	});
}

// 获取DSP日历价格
export function getDspCanPrice(params) {
	return request({
		url: `/app/experience/new/queryDspCalendarPrices`,
		method: "POST",
		params,
	});
}

// 获取DSP购买信息
export function getItinerary(params) {
	return request({
		url: `/app/experience/new/itineraryV2`,
		method: "POST",
		params,
	});
}

// 获取DSP 日历价格
export function getDSPPrice(params) {
	return request({
		url: `/app/experience/new/queryCurrentDspCalendarPrices`,
		method: "POST",
		params,
	});
}

// 更新或删除DSP
export function updateOrDeleteDsp(params) {
	return request({
		url: `/app/experience/new/updateOrDeleteDsp`,
		method: "POST",
		params,
	});
}

// 获取dsp列表
export function getDSPList(params) {
	return request({
		url: "/app/experience/new/page",
		method: "POST",
		params,
	});
}

// 获取 权益券商品详情
export function getEquity(params) {
	return request({
		url: `/product/agencyProduct/details`,
		method: 'POST',
		params
	})
}
// 更新或删除DSP
export function updateOrDeleteDspV2(params) {
	return request({
		url: `/app/experience/new/updateOrDeleteDspV2`,
		method: "POST",
		params,
	});
}

// 获取体验页导航线路V2
export function getNavigationInfoV2(params) {
	return request({
		url: `/app/experience/new/getNavigationInfoV2`,
		method: "POST",
		params,
	});
}

// 获取DSP的POI间导航路径坐标集合，用于路径移动动画
export function getNavigationInfo(params) {
	return request({
		url: `/app/experience/new/getNavigationInfo`,
		method: "POST",
		params,
	});
}

// 编辑过的DSP
export function editedDsp(params) {
	return request({
		url: `/app/experience/new/editedDsp`,
		method: "POST",
		params,
	});
}
// 已购买的行程
export function myJourney(params) {
	return request({
		url: `/app/experience/new/myJourney`,
		method: "POST",
		params,
	})
};
// 新建会话
export function newConversation(params) {
	return request({
		url: `/ai/aihub/chat/newConversation`,
		method: 'POST',
		params,
	})
}

// 发送消息
export function sendMessage(params) {
	return request({
		url: `/ai/aihub/chat/chatToAssistant`,
		method: 'POST',
		params,
		timeout: 60000
	})
}

// 会话反馈
export function conversationFeedback(params) {
	return request({
		url: `/assistant/conversationFeedback`,
		method: 'POST',
		params,
	})
}

// 语音模型列表
export function requestTips(params) {
	return request({
		url: `/ai/aihub/chat/querySpeechModelList`,
		method: 'POST',
		params
	})
}

// 获取照片
export function getPictureByOrderId(params) {
	return request({
		url: "/vlog/wechat/travelPhotoAlbums/groupPhotos",
		method: "POST",
		params
	});
}

// 获取照册
export function getPhotoAlbums(params) {
	return request({
		url: "/vlog/wechat/travelPhotoAlbums/photoAlbumsV2",
		method: "POST",
		contentType: 'application/x-www-form-urlencoded',
		params
	});
}

// 获取任务漫画照片
export function getAIPictur(params) {
	return request({
		url: "/vlog/wechat/travelPhotoAlbums/getPhotoComics",
		method: "POST",
		params,
		timeout: 60000
	});
}

// 获取风格照片
export function getStyleAIPictur(params) {
	return request({
		url: "/vlog/wechat/travelPhotoAlbums/getPhotoComicsEnum",
		method: "POST",
		params,
		timeout: 60000
	});
}

/* 获取OSS信息 */
export const getOSSData = async (bucket) => {
	return request({
		url: `/ai/file/credential?bucket=${bucket}`,
		method: "GET",
	})
}




/* 获取vlog示例模板 */
export const getSampleTemplate = async (bucket) => {
	return request({
		url: `/vlog/wechat/video/getSampleTemplate`,
		method: "POST",
	})
}


/* 查询视频列表 */
export const getVideoList = function (pageNo = 1, pageSize = 10) {
	return request({
		url: `/vlog/wechat/video/groupPaging`,
		method: "POST",
		params: {
			pageNo,
			pageSize,
		},
	})
}

/* 查询视频详情 */
export const getVideoDetail = async (videoId, shareUserId) => {
	return request({
		url: `/vlog/wechat/video/getVideo`,
		method: "POST",
		params: { videoId, shareUserId },
	})
}

/* 修改视频名称 */
export const updateVideoName = async (videoId, videoName) => {
	return request({
		url: `/vlog/wechat/video/updateName`,
		method: "POST",
		params: {
			videoId,
			videoName,
		},
	})
}


/* 删除视频 */
export const deleteVideo = async (videoId) => {
	return request({
		url: `/vlog/wechat/video/delete`,
		method: "POST",
		params: {
			videoId,
		},
	})
}




/* 新增Vlog视频 */
export const addVlogVideo = async (params) => {
	return request({
		url: `/vlog/wechat/video/addVlog`,
		method: "POST",
		params
	})
}

/* 图片检测接口 */
export const censorImage = async (imgUrl) => {
	return request({
		url: `/vlog/wechat/video/imageCheck`,
		method: "POST",
		params: {
			imgUrl
		}
	})
}
//轮询查询消息
export function requestMessageDetail(chatId = '', conversationId = '', itineraryId = '', robotId, journeyDemand=null) {
	return request({
		url: `/ai/aihub/chat/loopAnswer`,
		method: 'POST',
		params: { 
			chatId, 
			conversationId, 
			itineraryId, 
			robotId, 
			journeyDemand ,
			destId:uni.getStorageSync('aiDestItem').destinationId,
			latitude : uni.getStorageSync('location') ? uni.getStorageSync('location').latitude : '',
     		longitude : uni.getStorageSync('location') ? uni.getStorageSync('location').longitude : ''
		}
	})
}
//加购DSP内POI商品查询接口
export function addPurchaseDspPOI(params) {
	return request({
		url: `/app/experience/new/addPurchaseDspPOI`,
		method: 'POST',
		params,
	})
}
//加购DSP内POI商品修改DSP
export function updateAddPurchaseDsp(params) {
	return request({
		url: `/app/experience/new/updateAddPurchaseDsp`,
		method: 'POST',
		params,
	})
}

/* 用户同意订阅模板消息 */
export const acceptSubscribe = async (templateIds) => {
	return request({
		url: `${apiPrefix}/subscribeMessage/acceptSubscribe`,
		method: "POST",
		params: {
			templateIds,
		},
	})
}

/* 查询穿越旅行-场景列表 */
export const getTripThroughSceneList = async (
	pageNo,
	pageSize = 10,
	sceneId,
	sceneType
) => {
	return request({
		url: `${apiPrefix}/tripThrough/pagingScene`,
		method: "POST",
		params: {
			pageNo,
			pageSize,
			params: { sceneId, sceneType },
		},
	})
}

/* 查询穿越旅行-场景列表(新) */
export const getTripThroughScenePage = async (
	pageNo,
	pageSize = 10,
	destId,
	sortType
) => {
	return request({
		url: `${apiPrefix}/tripThrough/page`,
		method: "POST",
		params: {
			pageNo,
			pageSize,
			params: { destId, sortType },
		},
	})
}

/* 查询穿越旅行-目的地列表 */
export const getTripThroughDestList = async () => {
	return request({
		url: `${apiPrefix}/tripThrough/dest/list`,
		method: "POST",
	})
}

/* 新增穿越旅行 */
export const addTripThrough = async (arg) => {
	return request({
		// hideErrorModal: true,
		errorModel: ResponseErrorProcessModel.throw,
		url: `${apiPrefix}/tripThrough/add`,
		method: "POST",
		params: arg,
	})
}

// 解锁照片
export function unlockPhoto(params) {
	return request({
		url: "/order/unlockPhoto",
		method: "POST",
		params
	});
}
//破冰-修改行程
export function getModifyItinerary(type) {
	return request({
		url: `/ai/aihub/modifyItinerary/${type}`,
		method: 'GET',
	})
}


// 查询DSP卡片推荐
export function getDSPCardInfo(itineraryPlanId) {
	return request({
		url: `/ai/aihub/chat/queryDSP`,
		method: 'POST',
		params: { itineraryPlanId },
	})
}

//编辑行程
export function editItinerary(params) {
	return request({
		url: `/ai/aihub/chat/editItineraryPage/detail`,  
		method: 'POST',
		params
	})
}

//推荐行程
export function recItinerary(params) {
	return request({
		url: `/ai/aihub/chat/recItinerary`,  
		method: 'POST',
		params
	})
}


//行程详情
export function tripDetail(params) {
	return request({
		url: `/ai/aihub/trip/detail`,  
		method: 'POST',
		params
	})
}

//行程详情
export function editItinerarySelectProduct(params) {
	return request({
		url: `/ai/aihub/chat/editItineraryPage/selectProduct`,  
		method: 'POST',
		params
	})
}

/* 编辑行程点击 选好了 按钮时调用，让后端拼接新的行程数据 */
export function editItineraryPageTemporary(params) {
	return request({
		url: `/ai/aihub/chat/editItineraryPage/temporary`,  
		method: 'POST',
		params
	})
}
//行程详情
export function updateItinerary(params) {
	return request({
		url: `/ai/aihub/chat/editItineraryPage/edit`,  
		method: 'POST',
		params
	})
}

//酒店下单
export function newHotelPlaceOrder(params) {
	return request({
		url: `/product/hotel/newHotelPlaceOrder`,  	
		method: 'POST',
		params 
	})
}
//出行提示
export function getUpcomingTravel(params) {
	return request({
		url: `/ai/aihub/trip/upcomingTravel`,  
		method: 'POST',
		params
	})
}

//酒店详情
export function hotelDetail(params) {
	return request({
		// url: `/product/hotel/newHotelDetails`, 
		url: `/product/hotel/newHotelDetailsSup`,
		method: 'POST',
		loading: true,
		params
	})
}

//酒店rp详情
export function hotelRpDetail(params) {
	return request({
		url: `/product/hotel/newHotelDetailsSupRp`,
		method: 'POST',
		loading: false,
		params
	})
}

//酒店标品信息详情
export function hotelInfoDetail(params) {
	return request({
		url: `/product/hotel/newHotelDetailsStd`,
		method: 'POST',
		params
	})
}

//挑选商品
export function selectProduct(params) {
	return request({
		url: `/ai/aihub/chat/editItineraryPage/selectProduct`,   
		method: 'POST',
		params
	})
}

//大致计划
export function queryRoughPlan(params) {
	return request({
		url: `/ai/aihub/trip/queryRoughPlan`,   
		method: 'POST',
		params
	})  
}

//查询推荐攻略信息
export function queryArticleDetail(params) {
	return request({
		url: `/ai/aihub/article/detail`,   
		method: 'POST',
		params
	})  
}

// 攻略翻页推荐-换一个
export function queryPageRecommend(params) {
	let data = {
		destId:uni.getStorageSync('aiDestItem').destinationId,
		...params
	}
	return request({
		url: `/ai/aihub/article/pageRecommend`,   
		method: 'POST',
		params:data
	})  
}

// 攻略翻页推荐-换一个
export function queryUserSummary(params) {
	let data = {
		destId:uni.getStorageSync('aiDestItem').destinationId,
		...params
	}
	return request({
		url: `/ai/aihub/article/userSummary`,   
		method: 'POST',
		params: data
	})  
}

//轮询查询攻略摘要
export function requestArticleLoopAnswer(uuid='') {
	return request({
		url: `/ai/aihub/article/loopAnswer`,
		method: 'POST',
		params: { uuid }
	})
}


//轮询查询攻略摘要
export function queryCardTemplate(type, itineraryPlanId ='', skuId ='',) {
	return request({
		url: `/ai/aihub/queryCardTemplate`,
		method: 'POST',
		params: { 
			"skuId": skuId,
			"itineraryPlanId": itineraryPlanId,
			"type": type
		}
	})
}
//获取卡片信息
export function queryCardTemplateDest(params) {
	return request({
		url: `/ai/aihub/queryCardTemplate`,
		method: 'POST',
		params
	})
}
//获取文中摘要
export function getArticleRelPoi(params) {
	return request({
		url: `/ai/aihub/article/relPoi`,
		method: 'POST',
		params
	})
}

/* 查询AI写真-套餐列表 */
export const getFaceChangePackagePage = async (
	pageNo,
	pageSize = 10,
	destId,
  	tagIds,
	sortType,
	aigcType
) => {
	return request({
		url: `${apiPrefix}/faceChange/getFaceChangePackagePage`,
		method: "POST",
		params: {
			pageNo,
			pageSize,
			params: { destId, tagIds, isAll:1, sortType, aigcType },
		},
	})
}

/* 查询AI写真-筛选条件 */
export const getFilterCriteria = async () => {
	return request({
		url: `${apiPrefix}/faceChange/getFilterCriteria`,
		method: "POST",
	})
}

/* 查询AI写真-套餐详情 */
export const getFaceChangeTemplate = async (
	packageId,
) => {
	return request({
		url: `${apiPrefix}/faceChange/getFaceChangeTemplate`,
		method: "POST",
		params: {
			packageId,
		},
	})
}

/* 查询AI写真-原片 */
export const queryUserOriginalPhoto = async (params) => {
	return request({
		url: `${apiPrefix}/faceChange/queryUserOriginalPhoto`,
		method: "POST",
		contentType: 'application/x-www-form-urlencoded',
		params: params,
	})
}

/* 查询AI写真-上传原片 */
export const uploadUserOriginalPhoto = async (originalPhotoUrl,aigcType) => {
	return request({
		url: `${apiPrefix}/faceChange/uploadUserOriginalPhoto`,
		method: "POST",
		contentType: 'application/x-www-form-urlencoded',
		params: {
			originalPhotoUrl,
			aigcType : aigcType ? aigcType : ''
		}
	})
}

/* 查询AI写真-上传原片 */
export const verifyCompliance = async (originalPhotoUrl) => {
	return request({
		url: `${apiPrefix}/faceChange/verifyCompliance`,
		method: "POST",
		contentType: 'application/x-www-form-urlencoded',
		params: {
			originalPhotoUrl,
		}
	})
}
/* AI造型图片检测 */
export const verifyVLogCompliance = async (originalPhotoUrl) => {
	return request({
		url: `${apiPrefix}/faceChange/verifyVlogCompliance`,
		method: "POST",
		contentType: 'application/x-www-form-urlencoded',
		params: {
			originalPhotoUrl,
		}
	})
}
/* AI写真-根据套餐生成相册 */
export const generateFaceChangePhotos = async (packageId, travelPhotoAlbumsId, url) => {
	return request({
		url: `${apiPrefix}/faceChange/generateFaceChangePhotos`,
		method: "POST",
		params: {
			packageId,
			travelPhotoAlbumsId,
			url
		},
		timeout:60000
	})
}
/* AI写真-生成分享海报 */
export const getWechatAppletShareInfo = async (params) => {
	return request({
		url: `/app/share/getWechatAppletShareInfo`,
		method: "POST",
		params,
	})
}
//获取文中摘要
export function getPromptRetrieve(params) {
	return request({
		url: `/ai/aihub/chat/promptRetrieve`,
		method: 'POST',
		params
	})
}
//获取聊天记录
export function getChatRecordPage(params) {
	return request({
		url: `/ai/aihub/chat/recordPage`,
		method: 'POST',
		params
	})
}
//清空聊天记录
export function clearRecord(params) {
	return request({
		url: `/ai/aihub/chat/clearRecord`,
		method: 'POST',
		params
	})
}
// 获取 分享打包商品
export function getShareDsp(params) {
	return request({
		url: `/product/shareDsp/detail`,
		method: 'POST',
		params
	})
}
// 查询解锁次数
export function queryUnlockingTimes() {
	return request({
		url: `/order/queryUnlockingTimes`,
		method: 'GET',
	})
}
// Aigc新首页
export function newAIgcHomePage(params) {
	return request({
		url: `/vlog/wechat/faceChange/newAigcHomePage`,
		method: 'POST',
		params
	})
}
// Aigc新首页
export function getMultiplePeopleFaceChangeTemplate(params) {
	return request({
		url: `/vlog/wechat/faceChange/getMultiplePeopleFaceChangeTemplate`,
		method: 'POST',
		params
	})
}

// 根据目的地获取数字人
export function getClothes(destId) {
	return request({
		url: `/ai/aihub/chat/clothes/${destId}`,
		method: 'GET',
	})
}

// 通过messageId获取问题内容
export function getUserMessage(params) {
	return request({
		url: `/ai/aihub/chat/getUserMessage`,
		method: 'POST',
		params:{
			"id": params.id,
			// "conversationId": 0,
			// "deviceId": "",
			// "userId": 0
		}
	})
}

// 通过行程期待返回想去的景点
export function getMessageCardInfo(params) {
	return request({
		url: `/ai/aihub/chat/tripRefresh`,
		method: 'POST',
		params
	})
}
